{% extends "base/base.html" %}
{% block body %}
	{% block logo %}
		<div class='index_logo'>
			<div class='logo'></div>
		</div>
	{% endblock %}
	{% block content %}
		<div class='index_content' id='tab_id'>
			<div class='treeTd'>
				<div class='title' id='jxd_title'>菜单</div>
				<div class='tree' id='menuTree'></div>
			</div>
			<div class='tabTd'>
				<div class='tool' id='menuTab'>
					<span class='showLeft show' callFunc='click:resizeTab'></span>
				</div>
				<div class='content' id='menuFrame' ></div>
			</div>
		</div>
	{% endblock %}
{% endblock %}

{% block script %}
	function queryMenu(p){
		$.java({
			action:"/do?action=menu.query",
			param:{parent:p.id},
			callback:function(data){
				treeHandle.exec(menuTree,"bindData",data);
			}
		});
	};
	var menuTree=$("#menuTree");
	yanhx.addCommon("load",function(){
		queryMenu({
			top:0
		});
	});
	yanhx.addFunc("resizeTab",function(){
		var tab=$("#tab_id");
		var tree=tab.children(".treeTd");
		var tabTd=tab.children(".tabTd");
		if(this.hasClass("show")){
			this.removeClass().addClass("showRight");
			tree.addClass("hideTree");
			tabTd.addClass("fullWidth");
		}else{
			this.removeClass().addClass("show").addClass("showLeft");
			tree.removeClass("hideTree");
			tabTd.removeClass("fullWidth");
		}
	});
	function queryMenu(cond){
		menuTree.listTree({
			dataUrl:'/do?action=menu.query',
			conditions:cond,
			hasSub:yanhx.findFunc("tree_hasSub"),
			fillItem:yanhx.findFunc("_tree_open")
		});
	};
	yanhx.exec("tabHandle.init",{
		tool:$("#menuTab"),
		content:$("#menuFrame"),
		max:8
	});
{% endblock %}